#include<stdio.h>
#include<math.h>

extern void suma(unsigned int* v1, unsigned int* v2, unsigned short n);
extern short int* sumaYResta(short int* v, short int* w, unsigned short n);
extern int prodInterno(short int* v1, char* v2, unsigned short n);
extern unsigned short* promedioVecinos(unsigned short* A, unsigned short n);
extern float* productoEscalar(float* v, float k, unsigned short n);
extern float* normalizar(int* v, unsigned short n);
extern float productoInterno(float* v, float* w, unsigned short n);


typedef unsigned int ui;
typedef unsigned short us;

void printv(ui* v,us n){
	us i=0;
	for(;i<n;i++) printf("%u,",v[i]); printf("\n");
}

void printsv(us* v,us n){
	us i=0;
	for(;i<n;i++) printf("%u,",v[i]); printf("\n");
}

void printfv(float* fv,int n){
	int i=0;
	for(i=0;i<n;i++) printf("%.2f,",fv[i]); printf("\n");
}

void printM(us* m,us n){
	us i=0;us j=0;
	for(;i<n;i++) {for(j=0;j<n;j++) printf("%u\t",m[i*n+j]); printf("\n");}
}


int main(){
	ui v1[]={1,2,3,4,5,6};
	ui v2[]={1,2,3,4,5,6};
	us n=6;
	suma(v1,v2,n);
	printv(v1,n);
	
	us sv1[]={1,2,3,4,5,6,7,8,9,10,11,12};
	us sv2[]={1,2,3,4,5,6,7,8,9,10,11,12};
	n=12;
	printsv(sumaYResta(sv1,sv2,n),n);
	
	char cv[]={1,2,3,4,5,6,7,8,9,10,11,12};
	printf("%d\n",prodInterno(sv1,cv,12));
	
	us A[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
	us*B=promedioVecinos(A,4);
	printM(B,4);
	
	float fv[]={1.2,1.5,2,2.5,3,3.5,4,4.5};
	float* fv2=productoEscalar(fv,1.5,8);
	printfv(fv2,8);
	
	int vi[]={1,2,3,4,5,6,7,8};
	printfv(normalizar(vi,8),8);
	
	float fvv[]={1,2,3,4,5,6,7,8,9,10,11,12};
	printf("%.2f\n",productoInterno(fvv,fvv,12));
	return 0;
}
